import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '序号',
    dataIndex: 'index',
    align: 'center',
    width: 60,
    customRender: ({ index }) => index + 1,
    fixed: 'left',
  },
   {
    title: '团队名称',
    align:"center",
    dataIndex: 'teamName',
    customRender: ({ text, record }) => {
      // 处理数据库字段名映射
      return record.teamName || record.team_name || text || '';
    }
   },
   {
    title: '产品类型',
    align:"center",
    dataIndex: 'productType',
    customRender: ({ text, record }) => {
      // 处理数据库字段名映射
      return record.productType || record.product_type || text || '';
    }
   },
   {
    title: '产品名称',
    align:"center",
    dataIndex: 'productName',
    customRender: ({ text, record }) => {
      // 处理数据库字段名映射
      return record.productName || record.product_name || text || '';
    }
   },
   {
    title: '单位名称',
    align:"center",
    dataIndex: 'itemName',
    customRender: ({ text, record }) => {
      // 处理数据库字段名映射
      return record.itemName || record.item_name || text || '';
    }
   },
   // 隐藏子合同ID列
   // {
   //  title: '子合同ID',
   //  align:"center",
   //  dataIndex: 'contractDetailInfoId',
   //  customRender: ({ text, record }) => {
   //    // 处理数据库字段名映射
   //    return record.contractDetailInfoId || record.contract_detail_info_id || text || '';
   //  }
   // },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime',
    customRender: ({ text, record }) => {
      // 处理数据库字段名映射
      return record.createTime || record.create_time || text || '';
    }
   },
];

//子表表格配置
export const teamMembersColumns: JVxeColumn[] = [
    // 隐藏所属团队字段
    // {
    //   title: '所属团队',
    //   key: 'teamId',
    //   type: JVxeTypes.input,
    //   width:"150px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    {
      title: '团队名',
      key: 'teamName',
      type: JVxeTypes.input,
      width:"150px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    // {
    //   title: '成员ID',
    //   key: 'sysUserId',
    //   type: JVxeTypes.input,
    //   width:"120px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    {
      title: '成员姓名',
      key: 'name',
      type: JVxeTypes.input,
      width:"120px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '任务角色',
      key: 'role',
      type: JVxeTypes.select,
      width:"120px",
      placeholder: '请选择${title}',
      defaultValue:'',
      options: [
        { label: '管理', value: '管理' },
        { label: '技术', value: '技术' },
      ]
    },
    {
      title: '产品名称',
      key: 'productName',
      type: JVxeTypes.input,
      width:"150px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '任务内容',
      key: 'assignmentContent',
      type: JVxeTypes.textarea,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '完成程度',
      key: 'assignmentStatus',
      type: JVxeTypes.input,
      width:"120px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '创建时间',
      key: 'createTime',
      type: JVxeTypes.datetime,
      width:"150px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  teamName: {title: '团队名称',order: 0,view: 'text', type: 'string',},
  productType: {title: '产品类型',order: 1,view: 'text', type: 'string',},
  productName: {title: '产品名称',order: 2,view: 'text', type: 'string',},
  itemName: {title: '单位名称',order: 3,view: 'text', type: 'string',},
  // 隐藏子合同ID字段
  // contractDetailInfoId: {title: '子合同ID',order: 4,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 5,view: 'datetime', type: 'string',},
  //子表高级查询
  teamMembers: {
    title: '团队成员表',
    view: 'table',
    fields: {
        // 隐藏所属团队字段
        // teamId: {title: '所属团队',order: 0,view: 'text', type: 'string',},
        teamName: {title: '团队名',order: 1,view: 'text', type: 'string',},
        // sysUserId: {title: '成员ID',order: 2,view: 'text', type: 'string',},
        name: {title: '成员姓名',order: 3,view: 'text', type: 'string',},
        role: {title: '任务角色',order: 4,view: 'text', type: 'string',},
        productName: {title: '产品名称',order: 5,view: 'text', type: 'string',},
        task: {title: '任务内容',order: 6,view: 'text', type: 'string',},
        completion: {title: '完成程度',order: 7,view: 'text', type: 'string',},
        createTime: {title: '创建时间',order: 8,view: 'datetime', type: 'string',},
    }
  },
};
